﻿
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System;
using System.ComponentModel;

namespace ibba.src.norisk.ServiceDeParaAreaSubLimite
{
    internal class Aux
    {
        public static ImageSource GetImageStatus(ServiceDeParaAreaSubLimite.EnumseTipoAcaoSQL pTipoAcao)
        {
            string path_img = pTipoAcao == EnumseTipoAcaoSQL.Delete ? Constantes.SourceImagem.BULLET_RED :
                              pTipoAcao == EnumseTipoAcaoSQL.Insert ? Constantes.SourceImagem.BULLET_GREEN :
                              Constantes.SourceImagem.BULLET_GRAY;

            return new BitmapImage(new Uri(path_img, UriKind.Relative));
        }
    }

    public partial class ProdutoItau
    {
        public string CodigoDescricao { get { return string.Format("{0} - {1}", this.Codigo, this.Descricao); } }
    }

    public partial class DeParaProdutoItau : ibba.src.sl.recursos.IDetailAux
    {
        public DeParaProdutoItau()
        {
            this.PropertyChanged += new PropertyChangedEventHandler(DeParaProdutoItau_PropertyChanged);
            RaisePropertyChangeImageStatus();

            this.CodigoUsuarioIncluiu = AppHelper.LoginUsuario;
            this.DataInclusao = DateTime.Now;
        }

        public void RaisePropertyChangeImageStatus()
        {
            this.RaisePropertyChanged("ImageStatus");
        }

        void DeParaProdutoItau_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (sender != null)
            {
                switch (e.PropertyName)
                {
                    case "TipoAcaoSQL":
                        RaisePropertyChangeImageStatus();
                        break;
                    default:
                        break;
                }
            }
        }

        public ImageSource ImageStatus
        {
            get
            {
                return Aux.GetImageStatus(base.TipoAcaoSQL);
            }
        }

        #region IDetailAux Members

        public sl.recursos.eTypeDetail TypeDetail
        {
            get { return (sl.recursos.eTypeDetail)base.TipoAcaoSQL; }
            set
            {
                base.TipoAcaoSQL = (EnumseTipoAcaoSQL)value;
                base.RaisePropertyChanged("TypeDetail");
            }
        }

        #endregion
    }

    public partial class Estrategia
    {
        public string CodigoDescricao { get { return string.Format("{0} - {1}", this.Codigo, this.Descricao); } }
    }

    public partial class DeParaEstrategia : ibba.src.sl.recursos.IDetailAux
    {
        public DeParaEstrategia()
        {
            this.PropertyChanged += new PropertyChangedEventHandler(DeParaEstrategia_PropertyChanged);
            RaisePropertyChangeImageStatus();

            this.CodigoUsuarioIncluiu = AppHelper.LoginUsuario;
            this.DataInclusao = DateTime.Now;
        }

        public void RaisePropertyChangeImageStatus()
        {
            this.RaisePropertyChanged("ImageStatus");
        }

        void DeParaEstrategia_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (sender != null)
            {
                switch (e.PropertyName)
                {
                    case "TipoAcaoSQL":
                        RaisePropertyChangeImageStatus();
                        break;
                    default:
                        break;
                }
            }
        }

        public ImageSource ImageStatus
        {
            get
            {
                return Aux.GetImageStatus(base.TipoAcaoSQL);
            }
        }

        #region IDetailAux Members

        public sl.recursos.eTypeDetail TypeDetail
        {
            get { return (sl.recursos.eTypeDetail)base.TipoAcaoSQL; }
            set
            {
                base.TipoAcaoSQL = (EnumseTipoAcaoSQL)value;
                base.RaisePropertyChanged("TypeDetail");
            }
        }

        #endregion
    }


    public partial class AreaInstitucional
    {
        public string CodigoDescricao { get { return string.Format("{0} - {1}", this.Codigo, this.Descricao); } }
    }

    public partial class DeParaAreaInstitucional : ibba.src.sl.recursos.IDetailAux
    {
        public DeParaAreaInstitucional()
        {
            this.PropertyChanged += new PropertyChangedEventHandler(DeParaAreaInstitucional_PropertyChanged);
            RaisePropertyChangeImageStatus();

            this.CodigoUsuarioIncluiu = AppHelper.LoginUsuario;
            this.DataInclusao = DateTime.Now;
        }

        public void RaisePropertyChangeImageStatus()
        {
            this.RaisePropertyChanged("ImageStatus");
        }

        void DeParaAreaInstitucional_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (sender != null)
            {
                switch (e.PropertyName)
                {
                    case "TipoAcaoSQL":
                        RaisePropertyChangeImageStatus();
                        break;
                    default:
                        break;
                }
            }
        }

        public ImageSource ImageStatus
        {
            get
            {
                return Aux.GetImageStatus(base.TipoAcaoSQL);
            }
        }

        #region IDetailAux Members

        public sl.recursos.eTypeDetail TypeDetail
        {
            get { return (sl.recursos.eTypeDetail)base.TipoAcaoSQL; }
            set
            {
                base.TipoAcaoSQL = (EnumseTipoAcaoSQL)value;
                base.RaisePropertyChanged("TypeDetail");
            }
        }

        #endregion
    }
}
